<template>
  <div class="app-container">
    <div class="contentBox">
      <div class="searchBox">
        <el-form :model="queryParams" ref="queryRef" :inline="true">
          <el-form-item prop="name" style="margin: 0 6px 0 0;">
            <el-input
                class="inputBox"
                v-model="queryParams.name"
                placeholder="请输入名称"
                clearable
                @keyup.enter="handleQuery"
            />
          </el-form-item>
          <el-form-item style="margin: 0 6px 0 0;">
            <el-button class="normalFormBg searchBtn" icon="Search" @click="handleQuery"></el-button>
            <el-button class="normalFormBg searchBtn" icon="Refresh" @click="resetQuery"></el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-row :gutter="10" style="margin: 16px 0;">
        <el-col :span="1.5">
          <div class="normalBtn pageFlex pageFlexCenter">
            <img src="@/assets/images/plus.png" class="normalBtn_icon">
            <div class="normalBtn_text">新增</div>
          </div>
        </el-col>
      </el-row>
      <el-table
          v-loading="loading"
          :data="dataList"
          border>
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column prop="date" label="日期" width="100" :show-overflow-tooltip="true" fixed="left"></el-table-column>
        <el-table-column prop="creditCode" label="物料编码" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="名称" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="货位号" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="规格" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="品牌型号" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="单位" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="入库数量" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="单价" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="总金额" width="150"></el-table-column>
        <el-table-column prop="creditCode" label="入库人" width="150"></el-table-column>
      </el-table>
      <div class="pageFlex pageAlignCenter pageSpaceBetween" style="margin-top: 20px;">
        <div class="totalText">共计 {{total}} 条</div>
        <el-pagination background layout="prev, pager, next" :total="total" :current-page="queryParams.page" :page-size="queryParams.pageSize" @current-change="handleCurrentChange"/>
      </div>
    </div>
  </div>
</template>
<script setup>
import { onMounted } from 'vue';
const queryParams = ref({
  page: 1,
  pageSize: 10,
  name: ''
})
const loading = ref(false);
const total = ref(0);
const dataList = ref([]);
function handleQuery(){
  queryParams.value.pageNum = 1;
  getList();
}
function resetQuery(){
  proxy.resetForm("queryRef");
  handleQuery();
}
function getList(){
  loading.value = true;
  setTimeout(()=>{
    dataList.value =  [
      {
        id: 1,
        name: '企业1'
      }
    ]
    loading.value = false;
  }, 1000)
}
function handleCurrentChange(e){
  console.log(e)
}
onMounted(()=>{
  getList();
})
</script>
<style lang='scss' scoped>
@import "@/assets/styles/public.scss";
:deep(.el-input){
  .el-input__wrapper{
    background-color: $formBgSet;
    box-shadow: none;
  }
}
.app-container{
  width: 100%;
  min-height: calc(100vh - 66px);
  background: #F8F8F9;
}
.contentBox{
  width: 100%;
  background-color: #FFFFFF;
  border-radius: 5px;
  box-sizing: border-box;
  padding: 12px;
  .searchBtn{
    width: 32px;
    height: 32px;
    font-size: 12px;
    padding: 0;
    border: none;
    margin: 0 6px 0 0px;
  }
  .btnSetBox{
    padding: 0 10px;
    box-sizing: border-box;
    border-right: 1px solid $borderColor;
    cursor: pointer;
    .text{
      height: 16px;
      line-height: 16px;
      color: var(--el-color-primary);
    }
    .img{
      width: 16px;
      height: 16px;
      margin-right: 2px;
    }
    &:last-child{
      border-right: none;
    }
  }
  .totalText{
    height: 22px;
    font-weight: 400;
    font-size: 14px;
    color: #1D2129;
    line-height: 22px;
  }
}
</style>